package com.czwx.bee.business.manager.modular.sys.model;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.beetl.sql.core.annotatoin.Table;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SecurityUser implements UserDetails {

    private Long id;

    private String username;

    private String password;

    private Long drainageId;

    private Integer userType;

    private String companyName;

    private String realName;

    private Integer status;

    private List<Map> resourceList;

    private Collection<? extends GrantedAuthority> grantList;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.grantList;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public SecurityUser(String name, String passWord){
        this.username=name;
        this.password=passWord;
    }
}
